/**
 * Created by Administrator on 2018/1/8.
 */
$(document).ready(function() {
    var login =document.getElementById("Login");
    var personHome = document.getElementById("PersonHome");
    $.ajax({
        type: "POST",
        url: "/user/ifLoginIn.do",
        async: false,
        success: function(date) {
            console.log(date.msg);
            status = date.msg;
            console.log(status);
        },
        error: function(date) {
            alert("服务器繁忙!");
        }
    });

    if(status =="0"){

        login.style.display = "block";
        personHome.style.display = "none";
    }
    else{

        login.style.display = "none";
        personHome.style.display = "block";
    }

});

function StartGame(){
    var status = "1";//未登录
    //验证用户是否登陆
    $.ajax({
        type: "POST",
        url: "/user/ifLoginIn.do",
        async: false,
        success: function(date) {
            console.log(date.msg);
            status = date.msg;
            console.log(status);
        },
        error: function(date) {
            alert("服务器繁忙!");
        }
    });
    if(status =="0")
        window.location.href = "/jsp/login.jsp";

    else
        window.location.href = "/jsp/game.jsp";
}


function toLogin(){
    window.location.href = "/jsp/login.jsp";
}

function toList(){
    window.location.href = "/jsp/List.jsp";
}



